#! /local/bin/perl -w

$prices = { "lduw"    => 2,
            "add"     => 1,
            "sub"     => 1,
            "mul"     => 7,
            "subcc"   => 1,
            "orcc"    => 1,
            "stw"     => 2,
            "std"     => 2,
            "stdf"    => 2,
            "sll"     => 2,
            "nop"     => 0,
            "bg"      => 1,
            "ba"      => 1,
            "be"      => 1,
            "bl"      => 1,
            "ble"     => 1,
            "bne"     => 1,
            "subc"    => 1,
            "ldf"     => 2,
            "ldd"     => 2,
            "lddf"    => 2,
            "fdivs"   => 30,
            "fmuls"   => 7,
            "fmovs"   => 1,
            "fadds"   => 3,
            "fsubs"   => 3,
            "fdivd"   => 30,
            "fmuld"   => 7,
            "fmovd"   => 1,
            "faddd"   => 3,
            "fsubd"   => 3,
            "stf"     => 2,
            "fitos"   => 3,
            "fitod"   => 3,
            "fstoi"   => 3,
            "fbule"   => 1,
            "fcmped"  => 2,
            "or"      => 1,
            "save"    => 1,
            "restore" => 1,
            "jmpl"    => 1,
            "call"    => 1,
            "sethi"   => 1 };

$price = 0;

for($l = <STDIN>; !($l=~/STATIC/); $l = <STDIN>){
	if(($opcode, $num) = ($l =~ /^([a-z]+)\s+([0-9]+).+$/)){
		if (exists $$prices{$opcode}) {
			$price += $num * $$prices{$opcode};
		}
		else {
#			execute("echo \"$opcode \" >> ../missing.dat");
		}
	}
}

@l = <STDIN>;

print "Application Finished: ".$price."\n";
